%include header.html posts=posts,BLOG_NAME=BLOG_NAME, title=title, allcates=allcates ,SUBTITLE=SUBTITLE, user=user
<!-- start main -->
<div id="main">
	<!-- start content -->
	<div id="content">
		%import re
		%if posts:
		%for post in posts:
			%id = post['_id']
			%title=post.get('title')
			%author = post.get('author')
			%content = post.get('content', '')
			%if post.get('categories', []):
				%cates = ''
					%for cate in post.get('categories',[]):
							%c = '<a  href="/categories/'+str(cate.get('_id'))+'/">'+cate.get('name')+'</a>,'
						%cates += c
					%end
				%categories = cates[0:-1]
			%else:
				%categories = '<a href="/categories/未分类/">未分类</a>'
			%end
			%ts = ''
			%for tag in post.get('tags', []):
				%t = '<a  href="/tags/'+tag+'/">'+tag+'</a>,'
				%ts += t
			%end
			%tags = ts[0:-1]
			%comm_num = post.get('comments')
			%date = post.get('date')
			%views = int(post.get('views', 0))
		<!-- start post -->
		<div class="post">
		  <!-- start title -->
		  <div class="title">
			<div class="title_text">
			  <h2><a href="/archrives/{{id}}">{{title}}</a></h2>
			  <p>
				<small>
				  Posted on {{date}} by 
				  <a href="/author/{{author}}/">{{author}}</a> {{views}} views
			  </small></p>
			</div>
			<div class="comments_number">
			  <p class="link" style="margin-top: 20px; text-align: center;">
				<a class="comments" href="/archrives/{{id}}#comments">{{comm_num}}</a>
			  </p>
			</div>
		  </div>
		  <!-- end title -->
		  <!-- start entry -->
		  <div class="entry">
			%if len(content) > 300:
			{{!content[0:300]}} ...
		  </div>
		  <p class="links">
			<a href="/archrives/{{id}}" class="more">Read More</a>
		  </p>
		  %else:
		  {{!content}}
		</div>
				  <!-- end entry -->
		%end
		<br />
		<!-- start footer -->
		<div class="footer">
		  <p>
			<small>
			  Posted in {{!categories}} | Tagged {{!tags}} |
			  <a href="/archrives/{{id}}#subcomment"> Leave a reply</a>
			</small>
		  </p>
		</div>
		<!-- end footer -->
		</div>
	<!-- end post -->
		%end
	%else:
	没有文章
	%end
	%include pagebar.html count=count, pagesize=pagesize, currurl=currurl
	</div>
    <!-- end content -->
	%include sidebar.html allcates=allcates, toptenart=toptenart, dates=dates
</div>
<br style="clear: both;">
<!-- end main -->
%include footer.html
</body>
</html>
